<extend name="Public/base" />
<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>业务列表</h2>
	</div>
        <h3 style="height: 33px; border-bottom: 1px solid #B1CEEF;line-height: 23px; color: #3176AD; font-weight: bold; margin-bottom: 10px">
         <div style="float:right;">
                <a  class="btn" href="{:U('catdel')}">已删除</a>
                <a  class="btn" href="{:U('add')}">新建预约单</a>
                <a  class="btn" href="{:U('index',array('yytime_start'=>$jryydate['start'],'yytime_end'=>$jryydate['end']))}">今日预约</a>
                <a  class="btn" href="{:U('index')}">所有订单</a>
          </div>      
            <div style="float:right;font-size:9px;color:red; line-height: 31px;">*注：选择<b>“今日预约”</b>后如果要查询其他单据，请先点击<b>“所有订单”</b>按钮。否则只能看到今日有预约的订单。-&gt; </div>
        </h3>
    <div class="data-table table-striped">
        <form action="{:U()}" method="post" style="padding: 5px;
        background: #eee;
        border: 1px solid #ccc;};
        count_form {      
        
        padding: 5px;
        background: #eee;
        border: 1px solid #ccc;};
        count_form {      
        padding: 5px;
        background: #eee;
        border: 1px solid #CFC7C7;">
            <p style="line-height:28px">
                订单号：<input type="text" class="cusinput" name="Reserve[ddbh]" style="width:120px;" value="{$post_data.ddbh}">
                姓名：<input type="text" name="Reserve[name]" class="cusinput" style="width:120px;" value="{$post_data.name}">
                手机：<input type="text" name="Reserve[phone]" class="cusinput" style="width:120px;" value="{$post_data.phone}">
                    <label>渠道</label>
                    <select name="Reserve[qd]" id="Reserve_cid">
                        <option  value="">全部</option>
                        <volist name="qudao" id="vo">
                        <option value="{$vo.uid|default=null}" <eq name="vo.uid" value="$post_data.qd"> selected</eq>>{$vo.name|default=null}</option>
                        </volist>
                    </select>
                        
                        <label for="">类别</label>
                    <select name="Reserve[lb]" id="Reserve_cid">
                        <option  value="">全部</option>
                        <volist name="liebei" id="vo">
                        <option value="{$vo.uid|default=null}" <eq name="vo.uid" value="$post_data.lb"> selected</eq>>{$vo.name|default=null}</option>
                        </volist>
                    </select>                                             
               
                        <label>线上门市</label>
                    <select name="Reserve[xsjd]" id="Reserve_usherid">
                        <option value="">所有</option>
                        <volist name="xianshang" id="vo">
                        <option value="{$vo.uid}"  <eq name="vo.uid" value="$post_data.xsjd"> selected</eq> >{$vo.nickname}</option>
                        </volist>
                     </select>    
                        <label>线下门市</label>
                    <select name="Reserve[xxjd]" id="Reserve_usherid">
                        <option value="">所有</option>
                        <volist name="xianxia" id="vo">
                        <option value="{$vo.uid}"  <eq name="vo.uid" value="$post_data.xxjd"> selected</eq> >{$vo.nickname}</option>
                        </volist>
                     </select>   
                              

                <br>
                建单时间：<input type="text" value="{$post_data.jdtime_start}" name="Reserve[jdtime_start]" class="date" style="width:80px;" onclick="laydate()"> - <input type="text" value="{$post_data.jdtime_end}" name="Reserve[jdtime_end]" class="date" style="width:80px;" onclick="laydate()">
                预约时间：<input type="text" value="{$post_data.yytime_start}" name="Reserve[yytime_start]" class="date" style="width:80px;" onclick="laydate()"> - <input type="text" value="{$post_data.yytime_end}" name="Reserve[yytime_end]" class="date" style="width:80px;" onclick="laydate()">
                签订时间：<input type="text" value="{$post_data.ddtime_start}" name="Reserve[ddtime_start]" class="date" style="width:80px;"onclick="laydate()"> - <input type="text" value="{$post_data.ddtime_end}" name="Reserve[ddtime_end]" class="date" style="width:80px;" onclick="laydate()">
                <br>

                    <if condition="in_array(4,session('user_auth.level'))">

                    <else />
                                客服工号：<select name="Reserve[kf]" id="Reserve_service_id">
                        <option value="">所有</option>
                        <volist name="kefu" id="vo">
                        <option value="{$vo.uid}" <eq name="vo.uid" value="$post_data.kf"> selected</eq>  >{$vo.nickname}</option>
                        </volist>
                                           </select>
                    </if>                        
                            订单状态：<select name="Reserve[ywstate]">
                        <option value="" selected >所有</option>
                           <volist name="state" id="vo">
                        <option value="{$vo.uid}" <eq name="vo.uid" value="$post_data.ywstate"> selected</eq>  >{$vo.name}</option>
                        </volist>
                                </select>

                重复预约：<select name="Reserve[cf]">
                    <option value="" selected="selected">所有</option>
                    <option value="0">未重复预约</option>
                    <option value="1">已重复预约</option>
                </select>

            <span class="buttons">
                <input type="submit"  id="submit" class="btn" value="开始查询">
            </span>
            </p>
        </form>
</div>
	<div class="cf">
<!-- 		<div class="fl">
            <a class="btn" href="{:U('add')}">新 增</a>
            <button class="btn ajax-post confirm" url="{:U('del')}" target-form="ids">删 除</button>
        </div> -->

    <div style="text-align: right;"> 本页共 <?php echo count($_list); ?> 条</div>
    </div>
    <!-- 数据列表 -->
    <div class="table-striped">
    <form class="items">
        <table style="background: white;    border-collapse: collapse;    width: 100%;    border: 1px #D0E3EF solid;">

       
        <thead>
            <tr>
            <!-- <th class="row-selected"><input class="check-all" type="checkbox"/></th> -->
            <th class="">ID</th>
            <th class="">姓名</th>
            <th class="">手机</th>
            <th class=""><a style="color:#FFFFFF" href="<if condition="$_GET['jdtime'] eq 'desc'">{:U('index',array('jdtime'=>'asc'))}<else />{:U('index',array('jdtime'=>'desc'))}</if>">建单时间</a></th>
            <th class=""><a style="color:#FFFFFF" href="<if condition="$_GET['yytime'] eq 'desc'">{:U('index',array('yytime'=>'asc'))}<else />{:U('index',array('yytime'=>'desc'))}</if>">预约时间</a></th>
            <th class=""><a style="color:#FFFFFF" href="<if condition="$_GET['kf'] eq 'desc'">{:U('index',array('kf'=>'asc'))}<else />{:U('index',array('kf'=>'desc'))}</if>">客服</a></th>
            <th class=""><a style="color:#FFFFFF" href="<if condition="$_GET['xsjd'] eq 'desc'">{:U('index',array('xsjd'=>'asc'))}<else />{:U('index',array('xsjd'=>'desc'))}</if>">线上门市</a></th>
            <th class=""><a style="color:#FFFFFF" href="<if condition="$_GET['xxjd'] eq 'desc'">{:U('index',array('xxjd'=>'asc'))}<else />{:U('index',array('xxjd'=>'desc'))}</if>">线下门市</a></th>
            <th class=""><a style="color:#FFFFFF" href="<if condition="$_GET['qdstase'] eq 'desc'">{:U('index',array('qdstase'=>'asc'))}<else />{:U('index',array('qdstase'=>'desc'))}</if>">渠道</a></th>
            <th class=""><a style="color:#FFFFFF" href="<if condition="$_GET['money'] eq 'desc'">{:U('index',array('money'=>'asc'))}<else />{:U('index',array('money'=>'desc'))}</if>">金额</a></th>
            <th class=""><a style="color:#FFFFFF" href="<if condition="$_GET['ywstase'] eq 'desc'">{:U('index',array('ywstase'=>'asc'))}<else />{:U('index',array('ywstase'=>'desc'))}</if>">订单状态</a></th>
            <th class=""><a style="color:#FFFFFF" href="<if condition="$_GET['lb'] eq 'desc'">{:U('index',array('lb'=>'asc'))}<else />{:U('index',array('lb'=>'desc'))}</if>">类别</a></th>
            <th class=""><a style="color:#FFFFFF" href="<if condition="$_GET['cztime'] eq 'desc'">{:U('index',array('cztime'=>'asc'))}<else />{:U('index',array('cztime'=>'desc'))}</if>">最后操作</a></th>
            <th class="">操作</th>
            </tr>
        </thead>
        <tbody>
            <notempty name="_list">
            <volist name="_list" id="vo">
            <tr>
              <!--   <td><input class="ids row-selected" type="checkbox" name="id[]" value="{$vo.id}" /></td> -->
                <td>{$vo.id}</td>
                <td>{$vo.name}</td>
                <td>{$vo.phone}</td>
                <td>{$vo.jdtime|date="Y-m-d",###}</td>
                <td>{$vo.yytime|date="Y-m-d",###}</td>
                <td><span><neq name="vo.kf" value="0">{$vo.kf}</neq></span></td>
                <td><span><neq name="vo.xsjd" value="0">{$vo.xsjd}</neq></span></td>
                <td><span><neq name="vo.xxjd" value="0">{$vo.xxjd}</neq></span></td>
                <td><span>{$vo.qd}</span></td>
                <td>
                <span class="money" id="money_{$vo.id}">{$vo.money}</span>
            
                <input  style="border:1px solid #333;height:20px;line-height:20px;width:50px;float:left; display:none;" type="text" name="money" value="{$vo.money}" id="input_{$vo.id}">
                <a href="javascript:tijiao({$vo.id});" style="float:right;width:40px;height:22px;line-height:22px;background:#eee;border:1px solid #777;color:#333; display:none;">提交</a>
                </td>
                <td><span class="ywstate" >{$vo.ywstate}</span></td>
                <td><span>{$vo.lb}</span></td>
                <td><span>{$vo.cztime|time_format}</span></td>
                <td>
                    <a class="gengxin" title="查看" href="{:U('catd?id='.$vo['id'])}"><img src="/Public/Admin/images/view.png" alt="查看">
                </td>
            </tr>
            </volist>
            <else/>
            <td colspan="14" class="text-center"> aOh! 暂时还没有内容! </td>
            </notempty>
        </tbody>
        </table>
    </form>
	</div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    <script src="__STATIC__/thinkbox/jquery.cookie.js"></script>

	<script type="text/javascript">
    //成交功能
       function tijiao(id){
            var a = $('#input_'+id).val();
            $.ajax({
                type: "POST",
                url: "{:U('cj')}",
                data: "money="+a+"&id="+id,
                success: function(msg){
                    // alert(msg);
                    $('.alert-content').html(msg);
                    $('#top-alert').addClass('alert-success').show();
                    $('#money_'+id).html(a).show();
                    $('#money_'+id).parent().parent('tr').find('.ywstate').html('成交');
                    $('#money_'+id).siblings().hide();
                    setTimeout(function(){$('#top-alert').hide();},5000); //延迟演示
                },
            });
        };

    //点击显示成交按钮
    $(".cj").click(function(){ 
        var username = {$quanxian}; 
        if(username == 1){
            $('#top-alert').show();
            $('.alert-content').html('您没有权限！');
            setTimeout(function(){$('#top-alert').hide();},2000);
        }else{
        $(this).parent().parent('tr').find('span').siblings().show();
        $(this).parent().parent('tr').find('.money').hide();
        }
        return false;
    });
    //点击显示分配按钮，ajax.get方法判断是否用户有权
    $(".fenpei").click(function(){
         var fenpeiurl = $(this).attr("href"); //获取当前标签中的URL
         $.get(fenpeiurl,function(data){
                    //alert("info: " + data.info + "\nStatus: " + data.status);
                    if(data.status == 0){ //判断是否有权限，0表示假
                       $('#top-alert').show();
                       $('.alert-content').html(data.info);
                       setTimeout(function(){$('#top-alert').hide();},2000); 
                    }else{
                        location.href = fenpeiurl; //跳转
                    }
                 });
            
         return false; 
    });
   //点击显示编辑按钮
   $(".gengxin").click(function(){
         var gengxinurl = $(this).attr("href"); //获取当前标签中的URL
         $.get(gengxinurl,function(data){
                    //alert("info: " + data.info + "\nStatus: " + data.status);
                    if(data.status == 0){ //判断是否有权限，0表示假
                       $('#top-alert').show();
                       $('.alert-content').html(data.info);
                       setTimeout(function(){$('#top-alert').hide();},2000); 
                    }else{
                        location.href = gengxinurl; //跳转
                    }
                 });
            
         return false; 
    });
	//搜索功能
	$("#search").trigger(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click(function(){
                 $(this).parent().parent('tr').find('td.money'); 
            });
			
		}
	});
     //导航高亮
            highlight_subnav('{:U('index')}');
	</script>
</block>
